<template>
	<div class="register">
		<header>
			<div><span class="leftBack" @click="leftBack"></span></div>
			<span class="title">title</span>
			<span></span>
		</header>
		<div class="iframe">
			<iframe :src="marketUrl" id="myrame" name="myrame" frameborder="no" scrolling="auto">
	            <p>你的浏览器不支持iframe标签</p>
			</iframe>
		</div>
	</div>
</template>
<script>
	import { mapState, mapGetters, mapMutations, mapActions } from 'vuex';
	export default {
		name: "register",
		data() {
			return {
				marketUrl: ""
			}
		},
		mounted: function() {
			this.title();
			this.marketUrl = this.$route.params.id;
		},
		methods: {
			title() {
				var iframe = document.querySelector("#myrame");
				//通过contentWindow获取ifame子页面的window窗体对象。(不允许跨域名访问)
				var iframeDocument = iframe.contentWindow.document.title;
//				$(".title").text(iframe.contentDocument.title);
			},
			leftBack() {
				if(window.history.length >= 1) {
					this.$router.back(-1);
				}
			}
		}
	}
</script>
<style scoped lang="scss">
	.register {
		width: 100%;
		height: 100%;
		position: relative;
		header {
			width: 100%;
			height: 45px;
			padding: 0 16px;
			box-sizing: border-box;
			display: flex;
			border-bottom: 1px solid #EDEDED;
			justify-content: space-between;
			align-items: center;
			font-size: 16px;
			.leftBack {
				width: 12px;
				height: 12px;
				display: inline-block;
				border-top: 3px solid #999;
				border-right: 3px solid #999;
				transform: rotate(-135deg);
			}
		}
		.iframe {
			width: 100%;
			overflow: hidden;
			position: absolute;
			top: 45px;
			bottom: 0px;
			iframe {
				width: 100%;
				height: 100%;
			}
		}
	}
</style>